package com.ts.crawler;


import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan
public class Application {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = null;
        try {
            applicationContext = new AnnotationConfigApplicationContext(Application.class);//初始化IOC容器
            //MyController crawler = applicationContext.getBean(MyController.class);//通过IOC容器获得你要执行的业务代码的类

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (applicationContext != null){
                applicationContext.close();
                System.out.println("普通java程序执行完成,IOC容器关闭。。。");
            }
        }
    }

}
